home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / lha / slideshow.lha / Show.ascii < prev    next >
Text File  |  2000-02-23  |  15KB  |  491 lines

  1. .Demo
  2. WBStartup
  3.  
  4. DEFTYPE.w
  5.  
  6. *ScrVP._ViewPort=0
  7. IsAGA.b=True ; Defaults to AGA
  8. Dim PlanarBuf.l(2) ; Base address of planar memory to output c2p to (allowed up to triple buffers)
  9.  
  10. PrefDisplayID.l=$0 ; Default ModeID (Pal:LowRes, or promotes to DoublePal:LowRes)
  11. PrefDisplayWidth.w=320 ; Default Width
  12. PrefDisplayHeight.w=240 ; Default Height
  13. PrefDisplayBuffering.b=3 ; 1..3. 1=Singlebuffered, 2=Doublebuffered, 3=Triplebuffered
  14. PrefDisplayMethod.b=2 ; 0=WritePixelArray8/WriteChunkyPixels, 1=MBlockScroll, 2=WritePixelArray(CGFX)
  15. PrefCGFXLock.b=True ; Wether when Method=1, CGFX LockBitmap will be attempted for safety and to get base address
  16. OSVersion.w=ExecVersion
  17. CGFXAvail.b=False ; Default
  18.  
  19. #DTAG_DISP=$80000000
  20. #DTAG_DIMS=$80001000
  21. #DTAG_MNTR=$80002000
  22. #DTAG_NAME=$80003000
  23. #LBMI_BASEADDRESS=$84001007
  24. #DIPF_IS_FOREIGN=$80000000
  25. #DIPF_IS_ECS=$00000010
  26. #DIPF_IS_AGA=$00010000
  27.  
  28. ;If Joyb(0)=0 AND Joyb(1)=0 Then Goto SkipSMR
  29.  
  30. NEWTYPE.SMode
  31.   DID.l
  32.   DWidth.l
  33.   DHeight.l
  34.   DDepth.w
  35.   DType.w
  36. End NEWTYPE
  37.  
  38. DEFTYPE.Hook myhook ; The hook for ASL tag as &myhook
  39. myhook\h_Entry=?hook
  40. MOVE.l a5,globalbase
  41. funcret.l=0
  42.  
  43. Dim SMRtags.TagItem(17)
  44. SMRtags(0)\ti_Tag=#ASLSM_InitialLeftEdge,160 ; X coord of requester
  45. SMRtags(1)\ti_Tag=#ASLSM_InitialTopEdge,0 ; Y coord of requester
  46. SMRtags(2)\ti_Tag=#ASLSM_InitialWidth,300 ; Width of requester
  47. SMRtags(3)\ti_Tag=#ASLSM_InitialHeight,400 ; Height of requester
  48. SMRtags(4)\ti_Tag=#ASLSM_InitialDisplayID,$21000 ; Default ModeID (Pal:LowRes)
  49. SMRtags(5)\ti_Tag=#ASLSM_InitialDisplayDepth,8 ; Default depth (8-bit usually)
  50. SMRtags(6)\ti_Tag=#ASLSM_InitialDisplayWidth,PrefDisplayWidth
  51. SMRtags(7)\ti_Tag=#ASLSM_InitialDisplayHeight,PrefDisplayHeight
  52. SMRtags(8)\ti_Tag=#ASLSM_InitialOverscanType,1 ; Default overscan type (Text)
  53. SMRtags(9)\ti_Tag=#ASLSM_InitialInfoOpened,1 ; Info window?
  54. SMRtags(10)\ti_Tag=#ASLSM_InitialInfoLeftEdge,350 ; X coord of info window
  55. SMRtags(11)\ti_Tag=#ASLSM_InitialInfoTopEdge,50 ; Y coord of info window
  56. SMRtags(12)\ti_Tag=#ASLSM_DoDepth,0 ; Depth gadget? (Generally NO for chunky 8-bit)
  57. SMRtags(13)\ti_Tag=#ASLSM_DoOverscanType,0 ; Overscan gadget?
  58. SMRtags(14)\ti_Tag=#ASLSM_DoWidth,0 ; Width gadget?
  59. SMRtags(15)\ti_Tag=#ASLSM_DoHeight,0 ; Height gadget?
  60. SMRtags(16)\ti_Tag=#ASLSM_FilterFunc,&myhook ; Address of callback hook routine
  61. SMRtags(17)\ti_Tag=#TAG_DONE,0
  62.  
  63. *sreq.SMode=0
  64. *sreq=AllocAslRequest_(2,&SMRtags(0)\ti_Tag)
  65. ok.b=AslRequest_(*sreq,&SMRtags(0)\ti_Tag)
  66.  
  67. If ok<>0
  68.   PrefDisplayID.l=*sreq\DID
  69.   PrefDisplayWidth.w=*sreq\DWidth
  70.   PrefDisplayHeight.w=*sreq\DHeight
  71. EndIf
  72. If (*sreq) Then FreeAslRequest_(*sreq)
  73.  
  74. Goto SkipSMR
  75.  
  76. ;*************************************************************************
  77. ; This is the statement that the hook will call.  Put the label before
  78. ; the statement you want to jump to.
  79. Runerrsoff
  80. hook_jump:
  81. Statement hook{*dahook.Hook, modeID.l, *smr.ScreenModeRequester}
  82.   ; We're inside the hook, and supposedly we should be able to do whatever
  83.   ; we want.
  84.   ; Filter modeID's here
  85.   SHARED funcret.l
  86.   DEFTYPE.DisplayInfo DisInfoBuf
  87.   DEFTYPE.DimensionInfo DimInfoBuf
  88.   DEFTYPE.MonitorInfo MonInfoBuf
  89.   DEFTYPE.NameInfo NamInfoBuf
  90.   ;Refer to Includes/Graphics/DisplayInfo.h or view newtypes
  91.   IDhandle.l=FindDisplayInfo_(modeID)
  92.   GetDisplayInfoData_ IDhandle,&DisInfoBuf,SizeOf.DisplayInfo,#DTAG_DISP,0
  93.   GetDisplayInfoData_ IDhandle,&DimInfoBuf,SizeOf.DimensionInfo,#DTAG_DIMS,0
  94.   GetDisplayInfoData_ IDhandle,&MonInfoBuf,SizeOf.MonitorInfo,#DTAG_MNTR,0
  95.   GetDisplayInfoData_ IDhandle,&NamInfoBuf,SizeOf.NameInfo,#DTAG_NAME,0
  96.   ;Do tests. True=Mode is valid, False=mode is invalid.
  97.   ;See newtypes for DisplayInfo,DimensionInfo,MonitorInfo and NameInfo for things to further test
  98.   If DimInfoBuf\MaxDepth<>8
  99.     ;No true-colour modes, only 8-bit
  100.     funcret=False
  101.   Else
  102.     funcret=True
  103.   EndIf
  104. End Statement
  105.  
  106. ;**********************
  107. ; Hook
  108. Macro goto_hook
  109.   JSR `1+6
  110. End Macro
  111.  
  112. globalbase: Dc.l 0
  113.  
  114. hook: ;This hook is called by the filter hook callback from screenmode requester, per item
  115. ; Store registers
  116. MOVEM.l   d1-d7/a0-a6,-(a7) ; Not d0!
  117.  
  118. ; Put parameters into dregs ready for a statement
  119. MOVE.l    a0,d0
  120. MOVE.l    a1,d1
  121. MOVE.l    a2,d2
  122.  
  123. ; Get global variable base
  124. MOVE.l    globalbase,a5
  125.  
  126. ; Goto hook statement
  127. !goto_hook{hook_jump}
  128.  
  129. GetReg d0,funcret ; return accept/discard
  130.  
  131. ; Restore registers
  132. MOVEM.l   (a7)+,d1-d7/a0-a6 ; Not d0!
  133.  
  134. RTS
  135. ;**********************
  136.  
  137. Runerrson
  138. .SkipSMR
  139.  
  140. Function.b CheckLib{Lib$,LibVer}
  141. ;Returns wether a specific library is available or not
  142.   *lib.l=OpenLibrary_(&Lib$,LibVer)
  143.   If *lib
  144.     CloseLibrary_ *lib
  145.     Function Return True
  146.   Else
  147.     Function Return False
  148.   EndIf
  149. End Function
  150.  
  151. Function.b InitDisplay{Title$}
  152. ;Creates a display for AGA or Graphics-Card output
  153. ;Title$=The screen title (not displayed)
  154.   SHARED PrefDisplayWidth,PrefDisplayHeight,PrefDisplayBuffering
  155.   SHARED *ScrVP,PrefDisplayID,IsAGA,PlanarBuf(),CGFXAvail
  156.  
  157.   ;Setup a test screen
  158.   Dim ScrTags.TagItem(13)
  159.   Rect.Rectangle\MinX=0,0,320,240 ; For test
  160.   ScrTags(0)\ti_Tag=#SA_Width,320 ; For test
  161.   ScrTags(1)\ti_Tag=#SA_Height,240; For test
  162.   ScrTags(2)\ti_Tag=#SA_Depth,8
  163.   ScrTags(3)\ti_Tag=#SA_DisplayID,PrefDisplayID
  164.   ScrTags(4)\ti_Tag=#SA_Type,$F
  165.   ScrTags(5)\ti_Tag=#SA_Quiet,True
  166.   ScrTags(6)\ti_Tag=#SA_ShowTitle,False
  167.   ScrTags(7)\ti_Tag=#SA_Behind,True
  168.   ScrTags(8)\ti_Tag=#SA_DClip,&Rect ; For test
  169.   ScrTags(9)\ti_Tag=#SA_Exclusive,False
  170.   ScrTags(10)\ti_Tag=#SA_Draggable,False
  171.   ScrTags(11)\ti_Tag=#SA_AutoScroll,False
  172.   ScrTags(12)\ti_Tag=#TAG_DONE,0
  173.   ScrTags(13)\ti_Tag=#TAG_DONE,0
  174.  
  175.   If CGFXAvail
  176.     IsAGA=1-(IsCyberModeID_(PrefDisplayID))
  177.   Else
  178.     ; Need to do a test
  179.     UsedChip.l=320*240 ; With test params (depth 8)
  180.     FreeChip.l=AvailMem_(#MEMF_CHIP)
  181.     Forbid_
  182.     If ScreenTags(0,Title$,&ScrTags(0))
  183.       NowChip.l=AvailMem_(#MEMF_CHIP)
  184.       Permit_
  185.       If FreeChip-NowChip<UsedChip
  186.         IsAGA=False
  187.       Else
  188.         IsAGA=True
  189.       EndIf
  190.       VWait 5
  191.       Free Screen 0
  192.       VWait 5
  193.     Else
  194.       ; Failed to open, so resort to fixed AGA LowRes
  195.       Permit_
  196.       IsAGA=True
  197.       PrefDisplayID=0
  198.       PrefDisplayWidth=320
  199.       PrefDisplayHeight=240
  200.     EndIf
  201.   EndIf
  202.  
  203.   If IsAGA
  204.     PrefDisplayHeight=240
  205.     PrefDisplayWidth AND $FFC0 ; Multiples of 64 for AGA
  206.   Else
  207.     PrefDisplayWidth AND $FFF0 ; Multiples of 16 for graphics card
  208.   EndIf
  209.   ScrTags(0)\ti_Tag=#SA_Width,PrefDisplayWidth
  210.   Rect.Rectangle\MinX=0,0,PrefDisplayWidth,PrefDisplayHeight
  211.   ScrTags(8)\ti_Tag=#SA_DClip,&Rect
  212.  
  213.   If IsAGA
  214.     ; AGA display
  215.     ScrTags(1)\ti_Tag=#SA_Height,PrefDisplayHeight ; Seperate buffers
  216.     ScrTags(3)\ti_Tag=#SA_DisplayID,PrefDisplayID
  217.     Forbid_
  218.     For Loop.w=0 To PrefDisplayBuffering-1
  219.       If Loop=0 Then WFlags.l=$1900 Else WFlags.l=$800
  220.       If AvailMem_(#MEMF_CHIP)>=(PrefDisplayWidth*PrefDisplayHeight)+16
  221.         Memory.l=AllocMem((PrefDisplayWidth*PrefDisplayHeight)+16,$10002) ; Chipram bitmap
  222.         Memory=(Memory+16) AND $FFFFFFF0 ; Align for move16's
  223.         If Memory
  224.           CludgeBitMap Loop,PrefDisplayWidth,PrefDisplayHeight,8,Memory ; Depth 8
  225.           If Loop=0
  226.             ScrTags(12)\ti_Tag=#SA_BitMap,Addr BitMap(0)
  227.             If ScreenTags(0,Title$,&ScrTags(0))=0
  228.               Permit_
  229.               Function Return False
  230.             EndIf
  231.           EndIf
  232. If Window(Loop,0,0,PrefDisplayWidth,PrefDisplayHeight,WFlags,"",0,0)=0 Then Function Return False
  233.           Menus Off
  234.         Else
  235.           Permit_
  236.           Function Return False
  237.         EndIf
  238.       Else
  239.         Permit_
  240.         Function Return False
  241.       EndIf
  242.       PlanarBuf(Loop)=Memory
  243.     Next Loop
  244.     Permit_
  245.   Else
  246.     ; Graphics-card display
  247.     ScrTags(1)\ti_Tag=#SA_Height,PrefDisplayHeight*PrefDisplayBuffering
  248.     If ScreenTags(0,Title$,&ScrTags(0))
  249.       For Loop.w=0 To PrefDisplayBuffering-1
  250.         If Loop=0 Then WFlags.l=$1900 Else WFlags.l=$800
  251. If Window(Loop,0,PrefDisplayHeight*Loop,PrefDisplayWidth,PrefDisplayHeight,WFlags,"",0,0)=0 Then Function Return False
  252.         Menus Off
  253.         ScreensBitMap 0,Loop
  254.         *TmpBmp.bitmap=Addr BitMap(Loop)
  255.         Offset.l=*TmpBmp\_ebwidth*(PrefDisplayHeight*Loop)
  256.         For DLoop.w=0 To 8-1 ; Depth of 8
  257.           *TmpBmp\_data[DLoop]=*TmpBmp\_data[DLoop]+Offset
  258.         Next DLoop
  259.       Next Loop
  260.     Else
  261.       Function Return False
  262.     EndIf
  263.   EndIf
  264.  
  265.   If Peek.l(Addr Screen(0))
  266.     DEFTYPE.DimensionInfo DimInfoBuf
  267.     GetDisplayInfoData_ FindDisplayInfo_(PrefDisplayID) AND $FFFFFFFF,&DimInfoBuf,SizeOf.DimensionInfo,#DTAG_DIMS,0
  268.     PrefDisplayLeft.w=((DimInfoBuf\TxtOScan\MaxX)-PrefDisplayWidth)/2
  269.     PrefDisplayTop.w=((DimInfoBuf\TxtOScan\MaxY)-PrefDisplayHeight)/2
  270.     *Scr._Screen=Peek.l(Addr Screen(0))
  271.     *ScrVP=ViewPort(0)
  272.     *ScrVP\DxOffset=PrefDisplayLeft,PrefDisplayTop
  273.     ScrollVPort_ *ScrVP
  274.     RethinkDisplay_
  275.     Menus Off
  276.     If *ScrVP\DHeight<>PrefDisplayHeight
  277.       Forbid_
  278.       *Scr\Height=PrefDisplayHeight ; Enforce y clipping
  279.       Permit_
  280.     EndIf
  281.     ScreenToFront_ *Scr
  282.     Function Return True
  283.   Else
  284.     Function Return False
  285.   EndIf
  286. End Function
  287.  
  288. .Main
  289. CGFXAvail.b=CheckLib{"cybergraphics.library",0}
  290. If CGFXAvail=False AND PrefDisplayMethod=2 Then PrefDisplayMethod=0
  291. InitPalette 0,256
  292. InitPalette 1,256
  293. If InitDisplay{"Game"}=False Then Goto Finish
  294. LoadRGB32_ *ScrVP,Peek.l(Addr Palette(0))
  295. If PrefDisplayMethod=0 AND OSVersion<40
  296.   MBitmap 5,PrefDisplayWidth,PrefDisplayHeight ; Temporary bitmap to allow WPA8 instead of WPL8's
  297. EndIf
  298.  
  299. MBitmap 0,PrefDisplayWidth,PrefDisplayHeight
  300. If IsAGA Then Mc2pWindow 0,PrefDisplayWidth,PrefDisplayHeight
  301.  
  302. InitBank 0,320*240,$10000
  303. CludgeBitMap 3,320,240,8,Bank(0)
  304. NEWTYPE.ScaleList
  305.   OpWidth.w
  306.   DestXOffset.w
  307.   SrcXOffset.q
  308.   XAddOffset.q
  309.   YAddOffset.q
  310. End NEWTYPE
  311. Dim Skale.ScaleList(240)
  312. Dim map.b(256)
  313. MBitmap 1,320,240
  314. MBitmap 2,320,240
  315. MBitmap 3,320,240
  316. buf.b=0
  317. cnt.b=0
  318. angrad.q=Pi/180
  319.  
  320. .Loop
  321.  
  322. .TitleIn
  323. VWait 50
  324. If Joyb(0)>0 OR Joyb(1)>0 Then Goto Finish
  325. Use BitMap 3
  326. CPUCls 3
  327. MUseBitmap 1
  328. MCls 0
  329. LoadBitMap 3,"TestImageA320x240.128",0
  330. LoadRGB32_ *ScrVP,Peek.l(Addr Palette(0))
  331. MPlanar16ToBitmap 3,Bank(0)
  332. CPUCls 3
  333. LoadBitMap 3,"EffectPic3.256"
  334. MPlanar16ToBitmap 2,Bank(0)
  335. its.l=0
  336. ResetTimer
  337. c=0
  338. For mag.q=1 To 240 Step 1.0
  339.   SourceX.q=160-((mag/2)*(320/240))+((120-(mag/2))*Cos(mag*angrad*3))+0.5
  340.   SourceY.q=120-(mag/2)+((120-(mag/2))*Sin(mag*angrad*5))+0.5
  341.   OpWidth.w=320
  342.   OpHeight.w=240
  343.   SourceXAdder.q=mag/240
  344.   SourceYAdder.q=mag/240
  345.   DestX.w=0
  346.   DestY.w=0
  347.   For y=0 To 239
  348.     Skale(y)\OpWidth=320
  349.     Skale(y)\DestXOffset=0
  350.     Skale(y)\SrcXOffset=0
  351.     Skale(y)\XAddOffset=((240-mag)*0.00001)
  352.     Skale(y)\YAddOffset=-((240-mag)*0.000001)
  353.   Next y
  354.   MUseBitmap 3,1
  355.   MPictureDissolveIn 2,c
  356.   c+1
  357.   MUseBitmap 0
  358.   MZoom SourceX,SourceY,SourceXAdder,SourceYAdder,DestX,DestY,OpWidth,OpHeight,False,1,&Skale(0)
  359.   Gosub Display
  360.   its+1
  361. Next mag
  362. MBlockScroll 0,0,320,240,0,0,3
  363. Gosub Display
  364. its+1
  365. ;Goto Report
  366.  
  367. .BloodlineIn
  368. VWait 50
  369. If Joyb(0)>0 OR Joyb(1)>0 Then Goto Finish
  370. Use BitMap 3
  371. CPUCls 3
  372. LoadBitMap 3,"TestImageB320x240.128",1
  373. MPlanar16ToBitmap 3,Bank(0)
  374. For c=0 To 127
  375.   map(c)=128+c
  376.   CopyColour 1,0,c,128+c
  377. Next c
  378. For c=128 To 255
  379.   map(c)=c
  380. Next c
  381. MReMap &map(0),3
  382. LoadRGB32_ *ScrVP,Peek.l(Addr Palette(0))
  383. CPUCls 3
  384. LoadBitMap 3,"EffectPic3.256"
  385. MPlanar16ToBitmap 2,Bank(0)
  386. its.l=0
  387. ResetTimer
  388. For c=0 To 255
  389.   MUseBitmap 3,0
  390.   MPictureDissolveIn 2,c
  391.   MUseBitmap 0
  392.   Gosub Display
  393.   its+1
  394. Next c
  395. MBlockScroll 0,0,320,240,0,0,3
  396. Gosub Display
  397. its+1
  398. ;Goto Report
  399.  
  400. Goto Loop
  401.  
  402. Report:
  403. t=Timer
  404. t=Max(t,1)
  405. its=Max(its,1)
  406. a.q=50.0/(t/its)
  407. WBenchToFront_
  408. WbToScreen 1
  409. Window 2,16,16,300,40,0,"Test results",1,0
  410. WindowOutput 2
  411. NPrint a," frames per second"
  412. NPrint " "
  413. NPrint "Press mouse/joy button..."
  414. VWait 20
  415. Repeat
  416. Until Joyb(0)<>0 OR Joyb(1)<>0
  417. Finish:
  418. End
  419.  
  420. .Display
  421. If IsAGA
  422.   Mc2p MBitmapPtr(0),PlanarBuf(buf)
  423.   If PrefDisplayBuffering>1
  424.     ShowBitMap buf
  425.     buf+1
  426.     If buf=PrefDisplayBuffering Then buf=0
  427.   EndIf
  428. Else
  429.   *RP0._RastPort=RastPort(0)
  430.   Select PrefDisplayMethod
  431.  
  432.     Case 0 ; WritePixelArray8
  433.     If PrefDisplayBuffering>1
  434.        *RP1._RastPort=RastPort(Min(PrefDisplayBuffering-1,cnt+1))
  435.       If OSVersion<40
  436.         MUseBitmap 5
  437.         MBlockScroll 0,0,PrefDisplayWidth,PrefDisplayHeight,0,0,0 ; From window in modulo bitmap, to nonmodulo bitmap
  438.         MUseBitmap 0
  439.         WritePixelArray8_ *RP1,0,0,PrefDisplayWidth-1,PrefDisplayHeight-1,MBitmapPtr(5),0
  440.       Else
  441.         WriteChunkyPixels_ *RP1,0,0,PrefDisplayWidth-1,PrefDisplayHeight-1,MBitmapPtr(0),MBitmapWidth(0)
  442.       EndIf
  443.       ClipBlit_ *RP1,0,0,*RP0,0,0,PrefDisplayWidth,PrefDisplayHeight,$C0
  444.       If PrefDisplayBuffering=3 Then cnt=1-cnt ; Toggle output buffer
  445.     Else
  446.       If OSVersion<40
  447.         MUseBitmap5
  448.         MBlockScroll 0,0,PrefDisplayWidth,PrefDisplayHeight,0,0,0 ; From window in modulo bitmap, to nonmodulo bitmap
  449.         MUseBitmap 0
  450.         WritePixelArray8_ *RP0,0,0,PrefDisplayWidth-1,PrefDisplayHeight-1,MBitmapPtr(5),0
  451.       Else
  452.         WriteChunkyPixels_ *RP0,0,0,PrefDisplayWidth-1,PrefDisplayHeight-1,MBitmapPtr(0),MBitmapWidth(0)
  453.       EndIf
  454.     EndIf
  455.  
  456.     Case 1 ; MBlockScroll
  457.     If CGFXAvail AND PrefCGFXLock
  458.       Dim CGFXTags.TagItem(1)
  459.       CGFXData.l=0
  460.       CGFXTags(0)\ti_Tag=#LBMI_BASEADDRESS,&CGFXData
  461.       CGFXTags(1)\ti_Tag=#TAG_DONE,0
  462.       LockHandle.l=LockBitMapTagList_(*RP0\_BitMap,&CGFXTags(0))
  463.       MCludgeBitmap 4,PrefDisplayWidth,PrefDisplayHeight*PrefDisplayBuffering,CGFXData
  464.     Else
  465.       MCludgeBitmap 4,PrefDisplayWidth,PrefDisplayHeight*PrefDisplayBuffering,*RP0\_BitMap\Planes
  466.     EndIf
  467.     If PrefDisplayBuffering>1
  468.       *RP1._RastPort=RastPort(Min(PrefDisplayBuffering-1,cnt+1))
  469.       MBlockScroll 0,0,PrefDisplayWidth,PrefDisplayHeight,0,PrefDisplayHeight+(cnt*PrefDisplayHeight),0 ; From modulo bitmap
  470.       ClipBlit_ *RP1,0,0,*RP0,0,0,PrefDisplayWidth,PrefDisplayHeight,$C0
  471.       If PrefDisplayBuffering=3 Then cnt=1-cnt ; Toggle output buffer
  472.     Else
  473.      MBlockScroll 0,0,PrefDisplayWidth,PrefDisplayHeight,0,0,0 ; From modulo bitmap
  474.     EndIf
  475.     MUseBitmap 0
  476.     If CGFXAvail AND (LockHandle<>0) AND PrefCGFXLock Then UnLockBitMap_ LockHandle
  477.  
  478.     Case 2 ; CGFXWriteChunkyPixels
  479.     If PrefDisplayBuffering>1
  480.       *RP1._RastPort=RastPort(Min(PrefDisplayBuffering-1,cnt+1))
  481.       WritePixelArray_ MBitmapPtr(0),0,0,MBitmapWidth(0),*RP1,0,0,PrefDisplayWidth,PrefDisplayHeight,#RECTFMT_LUT8
  482.       ClipBlit_ *RP1,0,0,*RP0,0,0,PrefDisplayWidth,PrefDisplayHeight,$C0
  483.       If PrefDisplayBuffering=3 Then cnt=1-cnt ; Toggle output buffer
  484.     Else
  485.       WritePixelArray_ MBitmapPtr(0),0,0,MBitmapWidth(0),*RP0,0,0,PrefDisplayWidth,PrefDisplayHeight,#RECTFMT_LUT8
  486.     EndIf
  487.   End Select
  488. EndIf
  489. Return
  490.  
  491.